classdef TestDotsDrawableDotKinetogram < dotsTestCase
    
    properties
        kinetogram;
        drawManager;
        drawGroup;
    end
    
    methods
        function self = TestDotsDrawableDotKinetogram(name)
            self = self@dotsTestCase(name);
        end
        
        function setUp(self)
            self.setUp@dotsTestCase;
            
            dotsTheScreen.reset;
            dotsTheDrawablesManager.reset;
            self.drawManager = dotsTheDrawablesManager.theObject;
            
            self.drawGroup = 'test kinetogram';
            self.kinetogram = self.drawManager.newObject('dotsDrawableDotKinetogram');
            self.drawManager.addObjectToGroup(self.kinetogram, self.drawGroup);
            self.drawManager.activateGroup(self.drawGroup);
            
            self.drawManager.openScreenWindow;
        end
        
        function tearDown(self)
            self.drawManager.closeScreenWindow;
            dotsTheDrawablesManager.reset;
            dotsTheScreen.reset;
            self.tearDown@dotsTestCase;
        end
        
        function testDrawDifferentThings(self)
            
            % draw no kinetogram
            self.drawManager.mayDrawNextFrame;
            
            % don't draw invisible kinetogram
            self.kinetogram.isVisible = false;
            self.drawManager.mayDrawNextFrame;
            
            % draw default dots
            self.kinetogram.isVisible = true;
            self.drawManager.mayDrawNextFrame;
            
            % draw with and without drunken behavior
            self.kinetogram.drunkenWalk = 10;
            self.drawManager.mayDrawNextFrame;
            self.kinetogram.drunkenWalk = 0;
            self.drawManager.mayDrawNextFrame;
            
            % draw without interleaving
            self.kinetogram.interleaving = 1;
            self.drawManager.mayDrawNextFrame;
            self.kinetogram.interleaving = 3;
            self.drawManager.mayDrawNextFrame;
            
            % draw with herd and independed motion
            self.kinetogram.isMovingAsHerd = true;
            self.drawManager.mayDrawNextFrame;
            self.kinetogram.isMovingAsHerd = false;
            self.drawManager.mayDrawNextFrame;
            
            % draw with flickering and walking behavior
            self.kinetogram.isFlickering = false;
            self.drawManager.mayDrawNextFrame;
            self.kinetogram.isFlickering = true;
            self.drawManager.mayDrawNextFrame;
            
            % draw with wrapping and scratch replotting
            self.kinetogram.isWrapping = false;
            self.drawManager.mayDrawNextFrame;
            self.kinetogram.isWrapping = true;
            self.drawManager.mayDrawNextFrame;
            
            % draw with limited and unlimited coherence lifetimes
            self.kinetogram.isLimitedLifetime = false;
            self.drawManager.mayDrawNextFrame;
            self.kinetogram.isLimitedLifetime = true;
            self.drawManager.mayDrawNextFrame;
        end
    end
end